1. Field of the Invention
The present invention relates to an apparatus and a method for stereo matching and a method of calculating an infinite distance corresponding point. More particularly, the present invention relates to setting of a search range to be used in stereo matching.
2. Description of the Related Art
A stereo processing apparatus is known in the prior art, which obtains a pair of photographed images with a stereo camera system and calculates a distance to an object (or a parallax) shown in the photographed images based on the pair of photographed images obtained from a stereo camera system. First, the processing apparatus identifies a correlated destination of a given pixel block of one photographed image (right image, for example) in the other photographed image (left image, for example) (stereo matching). Then, the processing apparatus calculates a parallax of the pixel block, that is, the amount of deviation in a horizontal direction between the position of the pixel block (a correlated source) on the right image and the position of the correlated destination on the left image.
As is commonly known, the correlated destination of a given pixel block in the right image (reference image) exists on an epipolar line in the left image (comparative image), or on the same horizontal line (at the same vertical coordinate) as the correlated source of the reference image is located, according to the principle of a stereo method. Accordingly, the parallax is calculated as the amount of rightward deviation with respect to a horizontal coordinate of the correlated source on the reference image. Here, assuming that the distance from the stereo camera system to an object is infinitely large, its theoretical parallax is zero and the correlated destination exists at the same horizontal coordinate as the correlated source. A point of the horizontal coordinate on the epipolar line of the correlated destination calculated when the object is located at an infinite distance is referred to as an “infinite distance corresponding point.” The amount of the rightward deviation (parallax) with respect to this infinite distance corresponding point increases as the distance to the object decreases. Therefore, a search range to be used when performing stereo matching may be set to be a predetermined range located to the right with respect to a point where the correlated destination is located most leftward, or the infinite distance corresponding point.
Acoordinate point of the correlated source on the reference image (hereinafter referred to as a “reference coordinate point”) and the infinite distance corresponding point on the comparative image theoretically coincide with each other as seen above. In actuality, however, there are many cases in which they deviate from each other. The degree of such deviation is not uniform over the whole image but varies depending on the location in the image. A potential cause of this deviation is that focal distances of the right and left cameras differ from each other, causing one of the images to be enlarged or reduced compared to the other. The deviation can also occur due to distortion of camera lenses or an error in camera mounting position, for instance. As a consequence, there can arise such a situation that the infinite distance corresponding point is located to the left (which is opposite to the normal direction) of the reference coordinate point. Thus, there arises a problem that, if the reference coordinate point is set to as starting point of a search range, it becomes impossible to identify a correlated destination located to the left of this starting point.
A potential solution to this problem would be to set the starting point of the search range to the left of the reference coordinate point with some margin. The amount of deviation of the infinite distance corresponding point from the reference coordinate point, however, is not uniform for different image areas as stated above. Therefore, when setting a margin of a fixed amount, it needs to be set to a larger amount than the amount of a maximum deviation of the infinite distance corresponding point. As a consequence, however, the search range widens as much as the increased amount of the margin thus provided, and this causes a problem that computational complexity involved in stereo matching increases, resulting in a reduction in processing speed. In addition, the possibility of mismatching increases as much as the increase in the search range. Consequently, there also arises a problem that the reliability of calculated parallaxes, or calculated distances, deteriorates.